home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / dom / nsIScriptGlobalObject.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  5KB  |  128 lines

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* vim: set ts=2 sw=2 et tw=80: */
  3. /* ***** BEGIN LICENSE BLOCK *****
  4.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  5.  *
  6.  * The contents of this file are subject to the Mozilla Public License Version
  7.  * 1.1 (the "License"); you may not use this file except in compliance with
  8.  * the License. You may obtain a copy of the License at
  9.  * http://www.mozilla.org/MPL/
  10.  *
  11.  * Software distributed under the License is distributed on an "AS IS" basis,
  12.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  13.  * for the specific language governing rights and limitations under the
  14.  * License.
  15.  *
  16.  * The Original Code is mozilla.org code.
  17.  *
  18.  * The Initial Developer of the Original Code is
  19.  * Netscape Communications Corporation.
  20.  * Portions created by the Initial Developer are Copyright (C) 1998
  21.  * the Initial Developer. All Rights Reserved.
  22.  *
  23.  * Contributor(s):
  24.  *
  25.  * Alternatively, the contents of this file may be used under the terms of
  26.  * either of the GNU General Public License Version 2 or later (the "GPL"),
  27.  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  28.  * in which case the provisions of the GPL or the LGPL are applicable instead
  29.  * of those above. If you wish to allow use of your version of this file only
  30.  * under the terms of either the GPL or the LGPL, and not to allow others to
  31.  * use your version of this file under the terms of the MPL, indicate your
  32.  * decision by deleting the provisions above and replace them with the notice
  33.  * and other provisions required by the GPL or the LGPL. If you do not delete
  34.  * the provisions above, a recipient may use your version of this file under
  35.  * the terms of any one of the MPL, the GPL or the LGPL.
  36.  *
  37.  * ***** END LICENSE BLOCK ***** */
  38.  
  39. #ifndef nsIScriptGlobalObject_h__
  40. #define nsIScriptGlobalObject_h__
  41.  
  42. #include "nsISupports.h"
  43. #include "nsEvent.h"
  44.  
  45. class nsIScriptContext;
  46. class nsIDOMDocument;
  47. class nsIDOMEvent;
  48. class nsPresContext;
  49. class nsIDocShell;
  50. class nsIDOMWindowInternal;
  51. class nsIScriptGlobalObjectOwner;
  52. struct JSObject;
  53.  
  54. #define NS_ISCRIPTGLOBALOBJECT_IID \
  55. { 0xd326a211, 0xdc31, 0x45c6, \
  56.  { 0x98, 0x97, 0x22, 0x11, 0xea, 0xbc, 0xd0, 0x1c } }
  57.  
  58. /**
  59.  * The JavaScript specific global object. This often used to store
  60.  * per-window global state.
  61.  */
  62.  
  63. class nsIScriptGlobalObject : public nsISupports
  64. {
  65. public:
  66.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISCRIPTGLOBALOBJECT_IID)
  67.  
  68.   virtual void SetContext(nsIScriptContext *aContext) = 0;
  69.   virtual nsIScriptContext *GetContext() = 0;
  70.   virtual nsresult SetNewDocument(nsIDOMDocument *aDocument,
  71.                                   nsISupports *aState,
  72.                                   PRBool aRemoveEventListeners,
  73.                                   PRBool aClearScope) = 0;
  74.   virtual void SetDocShell(nsIDocShell *aDocShell) = 0;
  75.   virtual nsIDocShell *GetDocShell() = 0;
  76.   virtual void SetOpenerWindow(nsIDOMWindowInternal *aOpener)=0;
  77.  
  78.   /**
  79.    * Let the script global object know who its owner is.
  80.    * The script global object should not addref the owner. It
  81.    * will be told when the owner goes away.
  82.    * @return NS_OK if the method is successful
  83.    */
  84.   virtual void SetGlobalObjectOwner(nsIScriptGlobalObjectOwner* aOwner) = 0;
  85.  
  86.   /**
  87.    * Get the owner of the script global object. The method
  88.    * addrefs the returned reference according to regular
  89.    * XPCOM rules, even though the internal reference itself
  90.    * is a "weak" reference.
  91.    */
  92.   virtual nsIScriptGlobalObjectOwner *GetGlobalObjectOwner() = 0;
  93.  
  94.   virtual nsresult HandleDOMEvent(nsPresContext* aPresContext, 
  95.                                   nsEvent* aEvent, 
  96.                                   nsIDOMEvent** aDOMEvent,
  97.                                   PRUint32 aFlags,
  98.                                   nsEventStatus* aEventStatus)=0;
  99.  
  100.   virtual JSObject *GetGlobalJSObject() = 0;
  101.  
  102.   /**
  103.    * Called when the global JSObject is finalized
  104.    */
  105.  
  106.   virtual void OnFinalize(JSObject *aJSObject) = 0;
  107.  
  108.   /**
  109.    * Called to enable/disable scripts.
  110.    */
  111.   virtual void SetScriptsEnabled(PRBool aEnabled, PRBool aFireTimeouts) = 0;
  112.  
  113.   /**
  114.    * Set a new arguments array for this window. This will be set on
  115.    * the window right away (if there's an existing document) and it
  116.    * will also be installed on the window when the next document is
  117.    * loaded.  If argc is nonzero, argv must be non-null.
  118.    *
  119.    * @param aArgc the number of args
  120.    * @param aArgv the pointer to the args.  This may be cast to jsval* and the
  121.    *        args are found at
  122.    *        ((jsval*)aArgv)[0], ..., ((jsval*)aArgv)[aArgc - 1]
  123.    */
  124.   virtual nsresult SetNewArguments(PRUint32 aArgc, void* aArgv) = 0;
  125. };
  126.  
  127. #endif
  128.